package com.richard.face.service;

import com.richard.face.dao.UserInfoDao;
import com.richard.face.entity.UserInfoEntity;
import jakarta.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class UserInfoService {
    @Autowired
    UserInfoDao userInfoDao;

    public  static UserInfoService userInfoService;

    @PostConstruct
    public void init() {
        userInfoService = this;
        userInfoService.userInfoDao = this.userInfoDao;
    }
    // 登录
    public List<UserInfoEntity> login(String user, String password) {
        return userInfoDao.login(user, password);
    }
    // 注册
    public int insert(String user, String password) {
        return userInfoDao.insert(user, password);
    }
    // 密码重置
    public int password_reset(String user, String password) {
        return userInfoDao.password_reset(user, password);
    };
    //更新
    public int update_user_profile(String user,String gender, String age, String classId, String stuId, String professional ,String nickname){
        return userInfoDao.update_user_profile(user,gender, age, classId,stuId, professional, nickname);
    }
//     查询学生信息
    public List<UserInfoEntity> select_user_profile(String user,String gender, String age, String classId, String stuId, String professional, String nickname){
        return userInfoDao.select_user_profile(user,gender, age, classId, stuId, professional, nickname);
    }
    // 查询所有学生信息
//    public List<UserInfoEntity> select_all_user_profile(String id,String user,String gender, String age, String classId, String stuId,String professional,String nickname){
//        return userInfoDao.selectAll(id,user,gender, age, classId, stuId, professional, nickname);
//    }
    // 删除某条数据
    public int delete_user_profile(String id){
        return userInfoDao.delete_user(id);
    }
    // 查询某条数据
    public List<UserInfoEntity> select_user(String user,String gender, String age, String classId, String stuId, String professional, String nickname){
        return userInfoDao.select_user(user,gender, age, classId, stuId, professional, nickname);
    }
   // 插入新用户(学生信息管理界面)
    public int insert_new_msg(String user,String password,String gender, String age, String classId, String stuId, String professional, String nickname){
        return userInfoDao.insert_new_msg(user,password,gender, age, classId, stuId, professional, nickname);
    }
}
